package com.xmcowell.sportpacemaster.base;

import android.app.Fragment;
import android.os.Bundle;

import com.xmcowell.sportpacemaster.utils.retrofit.ProgressDialogHandler;

/**
 * Created by Administrator on 2016/11/17.
 */

public abstract class BaseFragment extends Fragment {
    private ProgressDialogHandler mProgressDialogHandler;
    protected boolean isLoading = true;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    /**
     * 描述：数据初始化
     */
    protected abstract void initData();

    /**
     * 描述：界面初始化
     */
    protected abstract void initUI();

    /**
     * 描述：设置监听
     */
    protected abstract void setListener();
    public void showProgressDialog() {
        if (mProgressDialogHandler != null) {
            isLoading = true;
            mProgressDialogHandler.obtainMessage(ProgressDialogHandler.SHOW_PROGRESS_DIALOG).sendToTarget();
        }
    }

    public void dismissProgressDialog() {
        if (mProgressDialogHandler != null) {
            isLoading = false;
            mProgressDialogHandler.obtainMessage(ProgressDialogHandler.DISMISS_PROGRESS_DIALOG).sendToTarget();
        }
    }
}
